  <!-- sidebar start -->
    <div class="am-offcanvas-bar shop-offcanvas-bar">
      <div class="am-panel am-panel-default">
        <div class="am-panel-bd">
          <p>
            <span class="am-icon-bookmark"></span> 欢迎您！&nbsp;<strong id="username">-</strong>
            &nbsp;&nbsp;<a class="am-badge" href="javascript:void(0);" onclick="logout()">退出</a>
            <a class="am-badge am-badge-success" href="index.html">首页</a>
          </p>
        </div>
      </div>
      <ul class="am-list shop-sidebar-list am-text-xs">
        <li><a href="member_center_index.html"><span class="am-icon-home am-icon-fw"></span> 会员中心首页</a></li>
        <li class="shop-parent">
          <a class="am-cf" data-am-collapse="{target: '#collapse-nav-1'}"><span class="am-icon-shopping-bag am-icon-fw"></span> 交易信息 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
          <ul class="am-list am-collapse shop-sidebar-sub am-in" id="collapse-nav-1">
            <li><a href="member_receiver_order_list.html" class="am-cf"> 收货订单</a></li>
            <li><a href="member_send_order_list.html" class="am-cf"> 出货订单</a></li>
          </ul>
        </li>
        <li class="shop-parent">
          <a class="am-cf" data-am-collapse="{target: '#collapse-nav-2'}"><span class="am-icon-star am-icon-fw"></span> 萌宠管理 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
          <ul class="am-list am-collapse shop-sidebar-sub am-in" id="collapse-nav-2">
            <li><a href="member_product_list.html" class="am-cf"> 萌宠待售</a></li>
            <li><a href="member_favorite_list.html" class="am-cf"> 萌宠收藏</a></li>
            <li><a href="member_follow_list.html" class="am-cf"> 粉丝列表</a></li>
          </ul>
        </li>
        <li class="shop-parent">
          <a class="am-cf" data-am-collapse="{target: '#collapse-nav-4'}"><span class="am-icon-info-circle am-icon-fw"></span> 个人资料 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
          <ul class="am-list am-collapse shop-sidebar-sub am-in" id="collapse-nav-4">
            <li><a href="member_profile_input.html" class="am-cf"> 个人信息</a></li>
            <li><a href="member_password_modify.html" class="am-cf"> 修改密码</a></li>
            <li><a href="member_password_input.html" class="am-cf"> 安全问题</a></li>
            <li><a href="member_receiver_list.html" class="am-cf"> 收货地址</a></li>
          </ul>
        </li>
      </ul>
    </div>
  <!-- sidebar end -->
<script type="text/javascript">

    $(function(){

        //----->>>初始化网站顶部 Begin

        // 判断用户是否已经登录
        let jsonUser = sessionStorage.getItem("user");

        // 如果用户没有登录过，就直接返回
        if( !jsonUser ) return;

        // 如果用户已经登录，则执行下面代码
        let user = JSON.parse(jsonUser);

        // 显示用户名
        $('#username').text(user.username);

        //----->>>初始化网站顶部 End

    });// $(function());

/** 退出系统 **/
function logout(){

    // 当前用户token
    let token = sessionStorage.getItem("token");

    // 判断当前用户是否登录(token是否存在)
    if( !token ) {
        // token不存在的话，就清除session直接退出
        sessionStorage.clear();
        top.location.href = 'index.html';
        return;

    }// if( !token );

    Modal.register(['confirm','alert']);
    Modal.confirm("您确定要退出吗？",{
        relatedTarget: this,
        onConfirm: function(options) {
            $.ajax({
                type: 'POST',
                url: 'http://localhost:8080/user/logout',
                dataType: "json",
                data: { token: token},
                success: function() {

                    sessionStorage.clear();
                    top.location.href = 'index.html';
                    return;

                },
                error: function () {

                    sessionStorage.clear();
                    top.location.href = 'index.html';
                    return;

                }// error: function();
            });// $.ajax();
        }// onConfirm: function(options);

    });// Modal.confirm();

}// logout();

</script>
